package com.wang.es.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(indexName = "product")
public class Product {
    @Id
    private Long id; //商品id
    @Field(type = FieldType.Text)
    private String title;//商品名称
    @Field(type = FieldType.Keyword) //表示不可分割
    private String category;//分类名称
    @Field(type = FieldType.Double)
    private Double price;//商品价格
    @Field(type = FieldType.Keyword,index = false) //表示不做索引关联，不能用该字段进行查询
    private String images;//图片地址
}
